package demo1;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class Text {
    public static void main(String[] args) {
        LinkedList<Integer> list = new LinkedList<>();
        list.add(666);
        list.add(888);
        list.add(999);

        ArrayList<Number> arrayList = new ArrayList<>(list);
        arrayList.add(101);

        System.out.println(arrayList);
    }
    public static void main3(String[] args) {
        Game game = new Game();
        //得到一副除去大小王的牌：
        List<Poker> pokers = game.buyPokers();
        System.out.println(pokers);
        //洗牌：
        game.shuffle(pokers);
        System.out.println(pokers);

        //三人轮流抽五张牌：
        List<List<Poker>> hand = game.game(pokers);
        for (int i = 0; i < hand.size(); i++) {
            System.out.println("第"+(i+1)+"个人的牌为"+hand.get(i));
        }
        //剩下的牌为:
        System.out.println(pokers);
    }

    public static List<List<Integer>> generate(int numRows) {
        List<List<Integer>> list = new ArrayList<>();
        List<Integer> row = new ArrayList<>();
        row.add(1);
        list.add(row);

        for (int i = 1; i < numRows; i++) {
            List<Integer> prerow = list.get(i-1);
            List<Integer> currow = new ArrayList<>();
            //每一行的第一个 1
            currow.add(1);
            //中间部分的值
            for (int j = 1; j < prerow.size(); j++) {
                currow.add(prerow.get(j) + prerow.get(j-1));
            }
            //最后一行的 1
            currow.add(1);
            list.add(currow);
        }
        return list;
    }

    public static void main2(String[] args) {
        System.out.println(generate(7));
    }

    public static void main1(String[] args) {
        List<Character> list = new ArrayList<>();
        String s1 = "welcome to the programming world!";
        String s2 = "come";
        for (int i = 0; i < s1.length(); i++) {
            char ch = s1.charAt(i);
            if(!s2.contains(ch+"")){
                list.add(ch);
            }
        }
        for (int i = 0; i < list.size(); i++) {
            System.out.print(list.get(i)+" ");
        }
    }
}
